package br.com.basili.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.basili.entity.TechnicalArea;

@FacesConverter("areaConv")
public class AreaConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
		TechnicalArea c = new TechnicalArea();
		if( !arg2.equals("") || arg2 != null )
			c = new TechnicalArea(arg2);
		return c;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) {
		String s = "";
		if( arg2 == null || arg2.equals(""))
			return s;
		return ((TechnicalArea)arg2).getDesc();
	}

}
